Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1772599: Handle compressed images for libvirt and baremetal IPI #2657

Merged

Conversation

RobertKrawitz
Copy link
Contributor

@RobertKrawitz RobertKrawitz commented Nov 12, 2019

Handle compressed images in all platforms using locally-downloaded images.
xref #2645

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 12, 2019
@RobertKrawitz
Copy link
Contributor Author

/hold

This has a bit more stuff in it than it should.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 12, 2019
@RobertKrawitz
Copy link
Contributor Author

/hold cancel

Removed the extraneous stuff.

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 12, 2019
@abhinavdahiya
Copy link
Contributor

#2645

even previously the cache was uncompressing the data, although implicitly. why not update the cache to make sure it uncompresses the image always..?

This is not ideal as every comsumer needs to decompress when the cache should do it as expected.

@stbenjam
Copy link
Member

stbenjam commented Nov 12, 2019

even previously the cache was uncompressing the data, although implicitly. why not update the cache to make sure it uncompresses the image always..?

This is not ideal as every comsumer needs to decompress when the cache should do it as expected.

+1

This also affects the baremetal IPI platform as we use the QEMU image for our bootstrap:

bootstrapOSImage, err := libvirttfvars.CachedImage(bootstrapOSImage)

We will also need to have a change there to fix it.

It would be nice if the cache just held the uncompressed image already, can any platform take the gzipped? libvirt can't, and it appears openstack can't... so is there a reason to keep it around?

@hardys
Copy link
Contributor

hardys commented Nov 13, 2019

Does anyone know why we're gzipping a qcow image, instead of making sure the image itself is fully compressed and sparisfied?

@hardys
Copy link
Contributor

hardys commented Nov 13, 2019

Looks good, but I agree we need a solution for IPI baremetal and it would be nice if the decompression logic could be abstracted behind the existing cache interfaces so each platform doesn't have to care explicitly about it.

@sdodson
Copy link
Member

sdodson commented Nov 13, 2019

Does anyone know why we're gzipping a qcow image, instead of making sure the image itself is fully compressed and sparisfied?

I think @yuqi-zhang and @miabbott have the history here.

@ashcrow
Copy link
Member

ashcrow commented Nov 13, 2019

Does anyone know why we're gzipping a qcow image, instead of making sure the image itself is fully compressed and sparisfied?

I think @yuqi-zhang and @miabbott have the history here.

I can weigh in here. We've always gzip'd the images but previously we did not have the .gz extension. Even though the documentation told folks the images were gz and would be uncompressed via IPI download or the specific provided curl command, many folks manually downloaded, used the images as is, and they failed as the image wasn't valid without decompressing. To make it more obvious for everyone we added the .gz extension.

@yuqi-zhang
Copy link
Contributor

To add a bit, the coreos-assembler generates a qcow image from a base ostree, which is the base for all other images. These are then all zipped in the RHCOS pipeline before uploading.
We gzip e.g. the metal image because the coreos-installer takes a gzipped image for bare-metal installations. This has been the case since 4.1.

If you feel that the compression schema should be changed, that should probably come as an RFE since we haven't really explored it.

@RobertKrawitz
Copy link
Contributor Author

even previously the cache was uncompressing the data, although implicitly. why not update the cache to make sure it uncompresses the image always..?
This is not ideal as every comsumer needs to decompress when the cache should do it as expected.

+1

This also affects the baremetal IPI platform as we use the QEMU image for our bootstrap:

bootstrapOSImage, err := libvirttfvars.CachedImage(bootstrapOSImage)

We will also need to have a change there to fix it.

It would be nice if the cache just held the uncompressed image already, can any platform take the gzipped? libvirt can't, and it appears openstack can't... so is there a reason to keep it around?

I agree, doing this in the cache makes the most sense.

@abhinavdahiya
Copy link
Contributor

fedora coreos is using xz https://builds.coreos.fedoraproject.org/streams/testing.json
cc @ashcrow @yuqi-zhang
So this special casing to gz won't translate well soon..

And therefore i think i would like to keep the uncompressing part hidden into the downloading-caching code.

@hardys
Copy link
Contributor

hardys commented Nov 13, 2019

We've always gzip'd the images but previously we did not have the .gz extension. Even though the documentation told folks the images were gz and would be uncompressed via IPI download or the specific provided curl command, many folks manually downloaded, used the images as is, and they failed as the image wasn't valid without decompressing.

That hasn't been our experience for IPI baremetal FWIW - we've been downloading the openstack qcow2 for several months directly, and not gunzipped it until now:

$ file rhcos-43.81.20191028.2-openstack.x86_64.qcow2/rhcos-43.81.20191028.2-openstack.x86_64.qcow2
rhcos-43.81.20191028.2-openstack.x86_64.qcow2/rhcos-43.81.20191028.2-openstack.x86_64.qcow2: QEMU QCOW Image (v3), 17179869184 bytes

We had to explicitly unzip it ref openshift/ironic-rhcos-downloader#12 and also it seems the HTTP headers provided changed as well ref openshift/ironic-rhcos-downloader#13

@RobertKrawitz
Copy link
Contributor Author

fedora coreos is using xz https://builds.coreos.fedoraproject.org/streams/testing.json
cc @ashcrow @yuqi-zhang
So this special casing to gz won't translate well soon..

And therefore i think i would like to keep the uncompressing part hidden into the downloading-caching code.

I agree and I'm working on that.

@RobertKrawitz
Copy link
Contributor Author

Latest commit does decompression transparently in the cache (inspecting the file if it already exists). This simplifies everything.

@RobertKrawitz RobertKrawitz force-pushed the libvirt-uncompress branch 2 times, most recently from 9d58bdc to f51bf94 Compare November 13, 2019 19:29
@RobertKrawitz
Copy link
Contributor Author

@abhinavdahiya please re-review, after which I'll collapse the changes.

@RobertKrawitz RobertKrawitz force-pushed the libvirt-uncompress branch 2 times, most recently from 8e359ee to 389b4d8 Compare November 18, 2019 19:06
@RobertKrawitz
Copy link
Contributor Author

@abhinavdahiya rdy;

@abhinavdahiya
Copy link
Contributor

looks good @RobertKrawitz I think we can squash and move ahead.


reader = io.MultiReader(bytes.NewReader(buf), reader)
fileType := http.DetectContentType(buf)
logrus.Debugf("content type of %s is %s", filePath, fileType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/openshift_installer/2657/pull-ci-openshift-installer-master-e2e-openstack/2837#1:build-log.txt%3A1233

the output looks like is printing the entire os.File object.

maybe Detected content-type as <type> ?? because we are no longer using the file to detect content.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filePath is the filename. I think it's useful this way, so if something goes wrong somebody can look in the cache to see which file was misdetected or whatnot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(that failure was old, when I had file rather than filePath in there)

@openshift-ci-robot
Copy link
Contributor

@RobertKrawitz: This pull request references Bugzilla bug 1772599, which is valid.

In response to this:

Bug 1772599: Handle compressed images for libvirt and baremetal IPI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@RobertKrawitz
Copy link
Contributor Author

/retest
govet failure was running out of memory.

@RobertKrawitz
Copy link
Contributor Author

RobertKrawitz commented Nov 18, 2019

/hold cancel

1 similar comment
@RobertKrawitz
Copy link
Contributor Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2019
@RobertKrawitz
Copy link
Contributor Author

@stbenjam @abhinavdahiya please re-review and lgtm if appropriate.

@abhinavdahiya
Copy link
Contributor

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 18, 2019
@RobertKrawitz
Copy link
Contributor Author

@stbenjam (or someone) could you /lgtm please?

@hexfusion
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 18, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, cgwalters, hexfusion, RobertKrawitz, stbenjam

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@RobertKrawitz
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@RobertKrawitz
Copy link
Contributor Author

I think previously the Golang HTTP stack transparently did the equivalent of curl's --compressed. So yes, it Just Worked before, and the switch here definitely requires installer changes.

This accords with normal practice. The client normally decodes the transferred object in accord with the content-transfer-encoding:. There's a world of difference between content-transfer-encoding: gzip with content-type: binary/octet-stream and content-transfer-encoding: 8bit with content-type: application/x-gzip, even if the data stream on the wire is identical.

@openshift-merge-robot openshift-merge-robot merged commit b13dcbf into openshift:master Nov 19, 2019
@openshift-ci-robot
Copy link
Contributor

@RobertKrawitz: All pull requests linked via external trackers have merged. Bugzilla bug 1772599 has been moved to the MODIFIED state.

In response to this:

Bug 1772599: Handle compressed images for libvirt and baremetal IPI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.